package com.xsp.service.impl;

import com.xsp.dao.UserDao;
import com.xsp.entity.User;
import com.xsp.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author xsp
 * @date 2024/3/10
 * @desc
 */
@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserDao userDao;

    @Override
    public User find(String username, String password) {
        return userDao.select(username, password);
    }

    @Override
    public boolean add(User user) {
        return userDao.insertSelective(user) > 0;
    }

    @Override
    public boolean modify(User user) {
        return userDao.updateByPrimaryKeySelective(user) > 0;
    }

    @Override
    public boolean remove(Integer id) {
        return userDao.deleteByPrimaryKey(id) > 0;
    }
}
